//
//  ZRNavigationController.m
//  SinaByOC
//
//  Created by 张锐 on 16/3/14.
//  Copyright © 2016年 zhangr. All rights reserved.
//

#import "ZRNavigationController.h"
#import "ZRTabBarController.h"
#import "ZRLoginController.h"
@interface ZRNavigationController ()

@end

@implementation ZRNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    //设置navBar渲染色
    self.navigationBar.tintColor = [UIColor orangeColor];
    
    //添加通知监听
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(registerButtonClick) name:@"ZRVisitorViewRegisterButtonClick" object:nil];
        
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(loginButtonClick) name:@"ZRVisitorViewLoginButtonClick" object:nil];
    });
    
}

/**
 *  注册按钮点击
 */
-(void)registerButtonClick{
    
    NSLog(@"注册按钮点击");
}
/**
 *  登录按钮点击
 */
-(void)loginButtonClick{
    
    UINavigationController * navVC = [[UINavigationController alloc]initWithRootViewController:[[ZRLoginController alloc]init]];
    
    navVC.navigationBar.tintColor = [UIColor orangeColor];
    
    [self presentViewController:navVC animated:YES completion:nil];
    
}
//移除通知
-(void)dealloc{

    [[NSNotificationCenter defaultCenter]removeObserver:self name:@"registerButtonClick" object:nil];
    
    [[NSNotificationCenter defaultCenter]removeObserver:self name:@"loginButtonClick" object:nil];
    
}


@end
